<% if !@content_ver_id.nil? %>
	<h2><%= params[:case] %> Question</h2>
<% else %>
	<h2>Add a question</h2>
<% end %>

<script type="text/javascript">
	
	//function TableClick(objtd){
	
	//document.getElementById('Text1').value = objtd.textContent;
	
//	}



	function showData(obj) {
		////var table = document.getElementById("table_content_list");
		////rows = table.getElementsByTagName("tr"),
		//iRow, iTRow, cols;
		
		////cols = rows[0].getElementsByTagName("td");
		
		//for (iRow = 0, iTRow = rows.length; iRow < iTRow; iRow++) {
		  //  cols = rows[iRow].getElementsByTagName("td");
		    //if (cols.length > 0) {
		    //    continue;
		    //}
			
		    //customerId = cells[0].innerHTML;
		//}		
		////alert(cols.length);
		////document.getElementById("title").value = cols[2].innerHTML ;
		document.getElementById("title").innerHTML = obj.rows[obj.rowIndex].cells[1].innerHTML ;
	}

 
    
    



</script>


<p>
<div>
	<% form_tag( { :controller => "content", :action => "manage_article", :id => params[:id], :page => params[:page] }, :method => "post") do %>
		<table>
			<tr>
				<td>Category</td>
				<td>
					<% if !@content_ver_id.nil? %>
						<%= select_tag(:selCategory, options_from_collection_for_select(@categories, "id", "name", @content_edit.category_id.to_i)) %>
					<% else %>
						<%= select_tag(:selCategory, options_from_collection_for_select(@categories, "id", "name")) %>
					<% end %>
				</td>
			</tr>
			<tr>
				<td>Title</td>
				<td>
					<% if !@content_ver_id.nil? %>
						<%= text_field_tag :title, @content_edit.title, :size => ContentVersion::SUBJECT_SIZE, :maxlength => ContentVersion::SUBJECT_MAX_LENGTH %>
					<% else %>
						<%= text_field_tag :title, "", :size => ContentVersion::SUBJECT_SIZE, :maxlength => ContentVersion::SUBJECT_MAX_LENGTH %>
					<% end %>
				</td>
			</tr>
			<tr>
				<td>Body</td>
				<td>
					<% if !@content_ver_id.nil? %>
						<%= text_area_tag :body, @content_edit.body, :rows => 10, :cols => 80 %>
					<% else %>
						<%= text_area_tag :body, "", :rows => 10, :cols => 80 %>
					<% end %>
				</td>
			</tr>
			<tr>
				<td></td>
				<td><%= submit_tag("Save", :name => "save") %></td>
			</tr>
		</table>
		
		<% if !@content_ver_id.nil? %>
			<%= hidden_field_tag :hidCase, params[:case] %>
			<%= hidden_field_tag :hidConRawID, @content_edit.content_raw_id %>
			<%= hidden_field_tag :hidConVerID, @content_ver_id %>
		<% end %>
	<% end %>	
</div>
</p>

<p>
<div id="table_content">
	<%= render :partial => "contents_manage" %>
</div>
</p>

<p>
<div>
<%= will_paginate @contents, :params => { :id => params[:id] } %>
</div>
</p>
